package com.example.vp.controller.user;

import com.common.domain.R;
import com.common.holder.UserHolder;
import com.example.vp.domian.enetity.Subscribe;
import com.example.vp.domian.enetity.Type;
import com.example.vp.domian.enetity.User;
import com.example.vp.service.SubscribeService;
import com.example.vp.service.TypeService;
import com.example.vp.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Set;

@RestController("user-user")
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;
    @Autowired
    private SubscribeService subscribeService;
    @Autowired
    private TypeService typeService;

    @GetMapping("/getById/{userId}")
    public R getById(@PathVariable("userId") Long userId){
        return R.ok().data(userService.getUserById(userId));
    }
    /**
     * 根据ids获取用户
     * @param ids
     * @return
     */
    @GetMapping("/list")
    public R<List<User>> listUserByIds(@RequestParam("ids") Set<Long> ids){
        System.out.println("ids:"+ids);
        return R.ok().data(userService.listByIds(ids));
    }
    
    
    /**
     * 根据id关注用户
     */
    @PostMapping("/attention/{id}")
    public R attention(@PathVariable("id") Long id){
        userService.attentionUser(id);
        return R.ok().data(null);
    }

    /**
     * 获取用户信息，根据token
     * @return
     */
    @GetMapping
    public R getUser(){
        return R.ok().data(userService.getUser());
    }
    
    /**
     * 根据用户id查看详细粉丝
     */
    @GetMapping("/fans/{id}")
    public R getFans(@PathVariable("id") Long id){
        return R.ok().data(userService.getFans(id));
    }
    
    /**
     * 获取关注的人
     */
    @GetMapping("/attention")
    public R getAttention(@RequestParam Long id){
        return R.ok().data(userService.getAttentionVideo(id));
    }
    
    
    
    
    /**
     *获取获赞数 
     */

    
    /**
     * 获取收藏夹
     */


    /**
     * 用户订阅分类
     */

}
